<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0 auto;
            text-align: center;
        }
    </style>
</head>

<body>

    <input id="inp_one" type="text" value="">
    <input id="symbol" type="text" value="">
    <input id="inp_two" type="text" value="">
    <button onclick="check()">等于</button>
    <br>
    <input id="dd" type="text">
    <div id="show"></div>
    <br>
    <input id="one_n_add_id" type="text" value="">
    <button onclick="one_n_add()">1~n</button>
    <br>
    <input id="flowe_id" type="text" value="">
    <button onclick="flowers()">水仙提交</button>
</body>
<script>
    //简易计算器
    var one = document.getElementById("inp_one");
    var two = document.getElementById("inp_two");
    var sym = document.getElementById("symbol");
    function check() {
        if (sym.value == "+") {
            add();
        }
        else if (sym.value == "-") {
            down();
        }
        else if (sym.value == "*") {
            ride();
        }
        else{
            divide();
        }
    }
    function add() {
        var add_ = document.getElementById("show");
        add_.innerHTML = Number(one.value) + Number(two.value);
        var dd1 = document.getElementById("dd");
        dd.value = Number(one.value) + Number(two.value);
    }
    function down() {
        var down_ = document.getElementById("show");
        down_.innerHTML = Number(one.value) - Number(two.value);
    }
    function ride() {
        var ride_ = document.getElementById("show");
        ride_.innerHTML = Number(one.value) * Number(two.value);
    }
    function divide() {
        var divide_ = document.getElementById("show");
        divide_.innerHTML = Number(one.value) / Number(two.value);
    }
    //1~n
    function one_n_add(){
        var  one_n_add_ =document.getElementById("one_n_add_id");
          return_one_n = parseInt(one_n_add_.value) + Math.random();
          document.getElementById("show").innerHTML = return_one_n;
    }
    //水仙花数
    function flowers() {
        var flowers_, a, b, c;
        for (flowers_ = 100; flowers_ < 1000; flowers_++) {
            a = parseInt(flowers_ / 100);
            b = parseInt((flowers_ - a * 100) / 10);
            c = parseInt(flowers_ - a * 100 - b * 10);
            if (a * a * a + b * b * b + c * c * c == flowers_) {
                var flow = document.getElementById("flowe_id");
                if (flow == flowers_) {
                    var show_ = document.getElementById("show");
                    show_.innerHTML = "yes";
                }
                else{
                    var show_ = document.getElementById("show");
                    show_.innerHTML = "no";
                }
            }
        }
    }
    //素数
    function su(){
        123;
    }

</script>

</html>